<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WELCOME TO FILE MANAGER!!!</title>
</head>
<body>
<%@ page import="file_functions.*" %>
<%
//creating new Manager and using it to delete files
	Manager man = new Manager(new String((byte[])session.getAttribute("dir"), "UTF8"));
	byte[][] byt = (byte[][])session.getAttribute("list");
	session.setAttribute("list", null);
	session.setAttribute("dir", null);
	
	
	
	
	boolean result, result_m = true;
	if (byt != null) 
	{
		String[] list = new String[byt.length];
		for (int i = 0; i < byt.length; i++)
			list[i] = new String (byt[i], "UTF8");
		for (String selected : list)
	   {
		   result = man.delete_command(null, selected);
		   if (!result)
		   {
			   out.println("Can't delete "+selected+"<br>");
			   result_m = false;
		   }
	   }
	   if (result_m)
		   out.println("DELETED");
	}
	else
		out.println("Nothing to delete");
	%>
<br>
<a href = "main.jsp">back to manager</a>
</body>
</html>